-
Notifications
You must be signed in to change notification settings - Fork 286
descibeNode for new js runtime #543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bf5fe17 to
af1d49b
Compare
af1d49b to
d7f82e3
Compare
|
Looks good. I don't want to beat a dead horse, but.. It's a bit less direct, and doesn't depend on an Executor, versus: pub fn getNodePtr(self: *const Inspector, allocator: Allocator, , object_id: []const u8) !?*anyopaque {
const unwrapped = try self.session.unwrapObject(allocator, object_id);
const toa = getTaggedAnyOpaque(unwrapped.value) orelse return null;
if (toa.subtype == null or toa.subtype != .node) return error.ObjectIdIsNotANode;
return toa.ptr;
} |
src/cdp/domains/dom.zig
Outdated
| if (params.nodeId != null) { | ||
| const node = bc.node_registry.lookup_by_id.get(params.nodeId.?) orelse return error.NodeNotFound; | ||
| return cmd.sendResult(.{ .node = bc.nodeWriter(node, .{}) }, .{}); | ||
| } else if (params.objectId != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't really need a else here isn't it?
I would prefer have:
if (params.nodeId != null) {
// ...
}
if (params.objectId != null) {
// ...
}
return error.MissingParams;There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed : a698ff8
Note that it is correct since every if branch returns.
The if else structure was indicating that only one of the paths should be taking.
15a5956 to
a698ff8
Compare
Replaces: #524